Skip to content

Replace Psalm with PHPStan - #92

Open
vjik wants to merge 1 commit into
masterfrom
phpstan
Open

vjik wants to merge 1 commit into
masterfrom
phpstan

Conversation

@vjik

@vjik vjik commented Nov 24, 2026 •

Copy link
Copy Markdown
Member
Q A
Is bugfix? ❌
New feature? ❌
Breaks BC? ❌

Summary by Sourcery

Replace Psalm with PHPStan as the project’s static analysis tool.

Enhancements:

  • Replace Psalm with PHPStan for project static analysis and update type annotations and assertions accordingly.
  • Simplify reflection type handling by removing obsolete checks and unreachable intersection-type logic.

Build:

  • Switch development dependencies, scripts, and configuration from Psalm to PHPStan.

CI:

  • Run the static analysis workflow with PHPStan and trigger it on PHPStan configuration changes.

Documentation:

  • Update static analysis documentation to reference PHPStan and remove the obsolete type-coverage badge.

Chores:

  • Remove the Psalm configuration and related suppression annotations.

@codecov

codecov Bot commented Nov 24, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.34%. Comparing base (10c5825) to head (1d30d22).

Additional details and impacted files
@@             Coverage Diff              @@
##             master      #92      +/-   ##
============================================
+ Coverage     96.06%   96.34%   +0.27%     
+ Complexity      111      108       -3     
============================================
  Files            10       10              
  Lines           305      301       -4     
============================================
- Hits            293      290       -3     
+ Misses           12       11       -1     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@vjik
vjik requested a review from a team November 24, 2026 12:33
@vjik vjik added the status:code review The pull request needs review. label Nov 24, 2026
@sourcery-ai

sourcery-ai Bot commented Nov 24, 2026

Copy link
Copy Markdown

Sorry @vjik, you've used your own review budget of 250,000 diff characters for the last 7 days.

You can request another review in 2 days and 22 hours by commenting @sourcery-ai review. Upgrade to get a review now.

@sourcery-ai

sourcery-ai Bot commented Nov 24, 2026

Copy link
Copy Markdown

Reviewer's Guide

Data structures

Update the documented shapes of the class and method configuration data structures for PHPStan.

  • src/Config/ClassConfig.php L46
  • src/Config/MethodConfig.php L25-26, L40

Replace Psalm assertions with PHPStan assertions for the parameter and return-type configuration checks.

  • src/Config/ParameterConfig.php L57

API

Update the documented public proxy APIs and their PHPStan-compatible argument and return annotations.

  • src/ObjectProxy.php L89-93 (+5 small edits)
  • src/ProxyManager.php L43-46, L59-63 (+4 small edits)

Implementation

Adjust reflection handling and type rendering to satisfy PHPStan, including removing redundant checks and unreachable union handling.

  • src/ClassConfigFactory.php L45-52, L197-201, L244-250 (+7 small edits)

Update the parameter-map annotation used by the class renderer to PHPStan-compatible array-shape notation.

  • src/ClassRenderer.php L320, L322 (removed lines)

Configuration

Replace the Psalm workflow and dependency with PHPStan, add its command and configuration, and update workflow path triggers.

  • .github/workflows/static.yml L7, L22-23
  • composer.json L35, L39 (removed lines), L55
  • phpstan.neon L1-5
  • psalm.xml (deleted)

Documentation

Record the analyzer migration and related cleanup in the changelog, remove the Psalm coverage badge, and document how to run PHPStan.

  • CHANGELOG.md L5-7
  • docs/internals.md L21-24
  • README.md L15 (removed lines)

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

status:code review The pull request needs review.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant